/** 客户管理路由 */
import Layout from '@/views/layout/customerLayout'

const customersRouter = {
  path: 'customers',
  meta: {
    requiresAuth: true,
    icon: 'yuzhen-customer',
    title: '客户管理'
  },
  children: [
    {
      path: 'total-customer', // 公海列表
      component: () => import('@/views/customermanagement/customer/TotalCustomerIndex'),
      meta: {
        requiresAuth: false,
        title: '我的客户（全部）',
        icon: 'yuzhen-customer',
        index: 1,
        type: 'crm',
      }
    },
    {
      path: 'leads', // 潜在客户列表
      component: () => import('@/views/customermanagement/leads/LeadsIndex'),
      meta: {
        requiresAuth: true,
        title: '潜在客户',
        icon: 'yuzhen-leads',
        index: 1,
        type: 'crm',
        subType: 'leads',
        label: 3
      }
    },
    {
      path: 'customer', // 目标客户列表
      component: () => import('@/views/customermanagement/customer/CustomerIndex'),
      meta: {
        requiresAuth: true,
        title: ' 目标客户',
        icon: 'yuzhen-customer',
        index: 1,
        type: 'crm',
        subType: 'customer',
        label: 3
      }
    },
    {
      path: 'seas', // 公海列表
      component: () => import('@/views/customermanagement/seas/SeasIndex'),
      meta: {
        requiresAuth: true,
        title: '公海',
        icon: 'yuzhen-seas',
        index: 1,
        type: 'crm',
        subType: 'pool'
      }
    },
  ]
}


const businessRouter = {
  path: 'business',
  meta: {
    requiresAuth: true,
    icon: 'yuzhen-business',
    title: '商机管理'
  },
  children: [
    {
      path: 'business', // 商机列表
      name: 'business',
      component: () => import('@/views/customermanagement/business/BusinessIndex'),
      meta: {
        requiresAuth: true,
        title: '我的商机（全部）',
        icon: 'yuzhen-business',
        index: 1,
        type: 'crm',
        subType: 'business'
      }
    },
    {
      path: 'business1', // 销售商机阶段列表
      name: 'business1',
      component: () => import('@/views/customermanagement/business/BusinessIndex1'),
      meta: {
        requiresAuth: true,
        title: '匹配客户需求',
        icon: 'yuzhen-business',
        index: 1,
        type: 'crm',
        subType: 'business',
        label: 3
      }
    },
    {
      path: 'business3', // 技术方案阶段列表
      name: 'business3',
      component: () => import('@/views/customermanagement/business/BusinessIndex3'),
      meta: {
        requiresAuth: true,
        title: '确认技术方案',
        icon: 'yuzhen-business',
        index: 1,
        type: 'crm',
        subType: 'business',
        label: 3
      }
    },
    {
      path: 'business6', // 订单合同阶段列表
      name: 'business6',
      component: () => import('@/views/customermanagement/business/BusinessIndex6'),
      meta: {
        requiresAuth: true,
        title: '签订合同',
        icon: 'yuzhen-business',
        index: 1,
        type: 'crm',
        subType: 'business',
        label: 3
      }
    },

    // {
    //   path: 'preSales', // 技术方案列表
    //   name: 'preSales',
    //   component: () => import('@/views/customermanagement/preSales/PreSalesIndex'),
    //   meta: {
    //     requiresAuth: true,
    //     title: '技术方案阶段',
    //     icon: 'yuzhen-contract',
    //     index: 1,
    //     type: 'crm',
    //     subType: 'preSales'
    //   }
    // },
    // {
    //   path: 'contract', // 合同列表
    //   component: () => import('@/views/customermanagement/contract/ContractIndex'),
    //   meta: {
    //     requiresAuth: true,
    //     title: '订单合同阶段',
    //     icon: 'el-icon-tickets',
    //     index: 1,
    //     type: 'crm',
    //     subType: 'contract'
    //   }
    // },
    {
      path: 'preSales', // 设备清单列表
      name: 'preSales',
      component: () => import('@/views/customermanagement/preSales/PreSalesIndex'),
      meta: {
        requiresAuth: true,
        title: '设备清单',
        icon: 'yuzhen-contract',
        index: 1,
        type: 'crm',
        subType: 'preSales'
      }
    },
    {
      path: 'quotation', // 报价列表
      name: 'quotation',
      component: () => import('@/views/customermanagement/quotation/QuotationIndex'),
      meta: {
        requiresAuth: true,
        title: '报价清单',
        icon: 'yuzhen-contract',
        index: 1,
        type: 'crm',
        subType: 'quotation'
      }
    },
    {
      path: 'contract', // 合同列表
      component: () => import('@/views/customermanagement/contract/ContractIndex'),
      meta: {
        requiresAuth: true,
        title: '合同清单',
        icon: 'el-icon-tickets',
        index: 1,
        type: 'crm',
        subType: 'contract'
      }
    },
    
  ]
}

// 路由配置
export const customerRouter = {
  path: '/crm',
  component: Layout,
  redirect: '/crm/message',
  name: 'crm',
  hidden: true,
  meta: {
    requiresAuth: true,
    title: '客户管理',
    index: 0,
    type: 'crm'
  },
  children: [
  
  {
    path: 'message', // 待办事项
    component: () => import('@/views/customermanagement/message/Message'),
    meta: {
      requiresAuth: false,
      title: '待办事项',
      icon: 'yuzhen-message',
      num: 0
    }
  },
  ...customersRouter.children,
  ...businessRouter.children,
  {
    path: 'followRecord', // 跟进记录列表
    component: () => import('@/views/customermanagement/followRecord/FollowRecordIndex'),
    meta: {
      requiresAuth: true,
      title: '我的日志',
      icon: 'el-icon-collection',
      index: 1,
      type: 'crm',
      subType: 'followRecord'
    }
  },
  {
    path: 'contacts', // 联系人列表
    component: () => import('@/views/customermanagement/contacts/ContactsIndex'),
    meta: {
      requiresAuth: true,
      title: '联系人',
      icon: 'yuzhen-contacts',
      index: 1,
      type: 'crm',
      subType: 'contacts'
    }
  },
  {
    path: 'workbench', // 仪表盘
    component: () => import('@/views/customermanagement/workbench/workbench'),
    meta: {
      requiresAuth: true,
      title: '仪表盘',
      icon: 'yuzhen-dashboard',
      index: 1,
      type: 'crm',
      subType: 'workbench'
    }
  },
  {
    path: 'quotationComb', // 报价组合
    component: () => import('@/views/customermanagement/quotation/QuotationComb'),
    meta: {
      requiresAuth: true,
      title: '报价组合',
      icon: 'el-icon-document-copy',
      index: 1,
      type: 'crm',
      subType: 'quotationComb'
    }
  },
  // {
  //   path: 'money', // 回款列表
  //   component: () => import('@/views/customermanagement/money/MoneyIndex'),
  //   meta: {
  //     requiresAuth: true,
  //     title: '回款',
  //     icon: 'money',
  //     index: 1,
  //     type: 'crm',
  //     subType: 'receivables'
  //   }
  // },
  // {
  //   path: 'product', // 产品列表
  //   component: () => import('@/views/customermanagement/product/ProductIndex'),
  //   meta: {
  //     requiresAuth: true,
  //     title: '产品',
  //     icon: 'product',
  //     index: 1,
  //     type: 'crm',
  //     subType: 'product'
  //   }
  // }
  ]
}

// export default customerRouter
// 菜单栏显示
export const crmRouterMenu = [
  {
    path: 'message', // 待办事项
    component: () => import('@/views/customermanagement/message/Message'),
    meta: {
      requiresAuth: false,
      title: '待办事项',
      icon: 'yuzhen-message',
      num: 0
    }
  },
  customersRouter,
  businessRouter,
  {
    path: 'followRecord', // 跟进记录列表
    component: () => import('@/views/customermanagement/followRecord/FollowRecordIndex'),
    meta: {
      requiresAuth: true,
      title: '我的日志',
      icon: 'el-icon-collection',
      index: 1,
      type: 'crm',
      subType: 'followRecord'
    }
  },
  
  {
    path: 'contacts', // 联系人列表
    component: () => import('@/views/customermanagement/contacts/ContactsIndex'),
    meta: {
      requiresAuth: true,
      title: '联系人',
      icon: 'yuzhen-contacts',
      index: 1,
      type: 'crm',
      subType: 'contacts'
    }
  },
  {
    path: 'quotationComb', // 报价组合
    component: () => import('@/views/customermanagement/quotation/QuotationComb'),
    meta: {
      requiresAuth: true,
      title: '报价组合',
      icon: 'el-icon-document-copy',
      index: 1,
      type: 'crm',
      subType: 'quotationComb'
    }
  },
  {
    path: 'workbench', // 工作台
    component: () => import('@/views/customermanagement/workbench/workbench'),
    meta: {
      requiresAuth: true,
      title: '仪表盘',
      icon: 'yuzhen-dashboard',
      index: 1,
      type: 'crm',
      subType: 'workbench'
    }
  },
]